
function CalendarSetup(content, datecon, hourcon, minutecon, setupDate, setupTime){
	var cal = Calendar.setup({
		cont         : content,
		showTime     : 12,
		minuteStep   : 30,
		date         : setupDate,
		time         : setupTime,
	    onSelect     : function() {
	        var date = cal.selection.get();
			var h = cal.getHours(), m = cal.getMinutes();
			if (h < 10) h = "0" + h;
			if (m < 10) m = "0" + m;
			if (date) {
				date = Calendar.intToDate(date);
				document.getElementById(datecon).value = Calendar.printDate(date, "%Y-%m-%d");
			}
			document.getElementById(hourcon).value = h;
			document.getElementById(minutecon).value = m;
	    },
	    onTimeChange  : function(cal) {
	    	var date = cal.selection.get();
			var h = cal.getHours(), m = cal.getMinutes();
			if (h < 10) h = "0" + h;
			if (m < 10) m = "0" + m;
			if (date) {
				date = Calendar.intToDate(date);
				document.getElementById(datecon).value = Calendar.printDate(date, "%Y-%m-%d");
			}
			document.getElementById(hourcon).value = h;
			document.getElementById(minutecon).value = m;
	    }
	});
	return cal;
}

function CalendarSetup(content, datecon, hourcon, minutecon){
	var cal = Calendar.setup({
		cont         : content,
		showTime     : 12,
		minuteStep   : 30,
		time         : 1800,
	    onSelect     : function() {
	        var date = cal.selection.get();
			var h = cal.getHours(), m = cal.getMinutes();
			if (h < 10) h = "0" + h;
			if (m < 10) m = "0" + m;
			if (date) {
				date = Calendar.intToDate(date);
				document.getElementById(datecon).value = Calendar.printDate(date, "%Y-%m-%d");
			}
			document.getElementById(hourcon).value = h;
			document.getElementById(minutecon).value = m;
	    },
	    onTimeChange  : function(cal) {
	    	var date = cal.selection.get();
			var h = cal.getHours(), m = cal.getMinutes();
			if (h < 10) h = "0" + h;
			if (m < 10) m = "0" + m;
			if (date) {
				date = Calendar.intToDate(date);
				document.getElementById(datecon).value = Calendar.printDate(date, "%Y-%m-%d");
			}
			document.getElementById(hourcon).value = h;
			document.getElementById(minutecon).value = m;
	    }
	});
	return cal;
}

function SetDate(cal, dates){
	cal.selection.set(dates);
	var date = cal.selection.get();
	cal.moveTo(date, true);
}

function SetDate(cal, dates, hour, min){
	cal.selection.set(dates);
	cal.setHours(hour);
	cal.setMinutes(min);
	var date = cal.selection.get();
	cal.moveTo(date, true);
}

